//
/***********************************************************
             File name:      main.c
             Author:         Bitat (陆叁柒)
             Email :         Bitat@qq.com
             Gitee :         https://gitee.com/bitat
             CSDN  :         https://blog.csdn.net/bitat
             History:        2023/2/20
 ************************************************************/


#include <stdio.h>

int main()
{
    int i = 0;
    int j = 0;
    int input = 0;
    int arr[20][20] = {0};

    printf("请输入打印的行数:>");
    scanf("%d", &input);

    for (i = 0; i <= input; i++)
    {
        arr[i][0] = 1;
        arr[i][i] = 1;
    }

    for (i = 3; i <= input; i++)
    {
        for (j = 1; j < i - 1; j++)
        {
            arr[i - 1][j] = arr[i - 1 - 1][j] + arr[i - 1 - 1][j - 1];
        }
    }

    for (i = 0; i < input; i++)
    {
        for (j = 0; j < input - i; j++)
        {
            printf("   ");
        }

        for (j = 0; j <= i; j++)
        {
            printf("%5d ", arr[i][j]);
        }

        printf("\n");
    }

    return 0;
}
